home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
c
/
uw_1.exe
/
UW_HELP5.HLP
< prev
next >
Wrap
Text File
|
1992-11-03
|
31KB
|
733 lines
`co(4,7);────────────────────────── /// General Macros ────────────────────────────────`co();
UltraWin also makes extensive use of macros ( defined in UW.H ) for simple
operations that do not justify the overhead of a function, and make your
programs more readable. The following are for general use.
`co(10,1);/// hibyte`co();
#define hibyte(c) (uchar) ((c) >> 8)
Yields the most significant byte of integer c.
`co(10,1);/// lobyte`co();
#define lobyte(c) (uchar) ((c) & 0x00ff)
Yields the least significant byte of integer c.
`co(10,1);/// lower`co();
#define lower (x, y) (x < y) ? x : y
Yields the lesser of the values x and y.
`co(10,1);/// range`co();
#define range(l,b,h) ((((b) >= (l)) && ((b) <= (h))))
Yields a 1 if b is between l and h inclusive.
`co(10,1);/// swap`co();
#define swap(a,b,c) ((c) = (a), (a) = (b), (b) = (c))
Swaps the values a and b utilizing a temporary c.
`co(10,1);/// upper`co();
#define upper (x, y) (x > y) ? x : y
Yields the greater of the values x and y.
`co(4,7);────────────────────────── /// Window Macros ─────────────────────────────────`co();
Many of the things you do with windows are only accomplished with the
window macros. The macros will allow you to perform several forms of
input/output to a window, change the window attributes, move the window
cursor within the window, and more. Nearly every access performed on
a window structure can be done using these macros. We recommend the use
of these macros wherever possible as it allows us to "hide" the data
structure, a common OOP technique. A close look at these macros will
give you some insight into how UltraWin uses the window structure.
`co(10,1);/// cls`co();
#define cls() (setmem(Screen, V_cols * V_rows * 2, 0))
Clears the entire screen to black.
`co(10,1);/// mv_cs`co();
#define mv_cs(c,r,wnp) ((wnp)->csr_x = (c), (wnp)->csr_y = (r))
Moves the "soft" cursor in window wnp to the column and row c and r.
`co(10,1);/// wn_att`co();
#define wn_att(a,wnp) ((wnp)->att = (a))
Sets the window attribute in wnp to the value a.
`co(10,1);/// wn_bdratt`co();
#define wn_bdratt(a,wnp) ((wnp)->bdr_att = (a))
Sets the window border attribute in wnp to the value a. This is
the complement to the wn_att macro.
`co(10,1);/// wn_bdr_color`co();
#define wn_bdr_color(f,b,wnp) ((wnp)->bdr_att = ((b) << 4) | (f))
Sets the border foreground and background colors in window wnp. This
is the complement to the wn_color macro.
`co(10,1);/// wn_color`co();
#define wn_color(f,b,wnp) ((wnp)->att = ((b) << 4) | (f))
Sets the foreground and background colors in window wnp. This is
done by setting the window attribute accordingly.
`co(10,1);/// wn_name`co();
#define wn_name(n, wnp) ((wnp)->name = (n))
Sets the name at the top of window wnp to the string n.
`co(10,1);/// wn_name_loc`co();
#define wn_name_loc(l, wnp) ((wnp)->name_loc = (l))
Sets the location of the name in window wnp to left, right, or
centered.
`co(10,1);/// wn_read`co();
#define wn_read( wnp ) (wn_io( IN, BUFF, (wnp)))
Pulls what is actually on the screen under the window into the
window itself! This is like wn_save, but instead of pulling the
area under the window into the save/restore buffer, it pulls it
into the window.
`co(10,1);/// wn_restore`co();
#define wn_restore( wnp ) (wn_io(OUT, SAVE, (wnp)))
Restores the area saved (by the macro wn_save) under the window wnp.
`co(10,1);/// wn_rfsh`co();
#define wn_rfsh( wnp ) (wn_io(OUT, BUFF, (wnp)))
Redraws (refreshes) the window wnp.
`co(10,1);/// wn_save`co();
#define wn_save( wnp ) (wn_io( IN, SAVE, (wnp)))
Saves the area under the window wnp to the window save area for later
restoration.
`co(10,1);/// wn_get_att`co();
#define wn_get_att(wnp) ((wnp)->att)
Returns the current window attribute. (See wn_att to set).
`co(10,1);/// wn_get_bdratt`co();
#define wn_get_bdratt(wnp) ((wnp)->bdr_att)
Returns the current window border attribute. (See wn_bdratt to set).
`co(10,1);/// wn_get_bdr_style`co();
#define wn_get_bdr_style(wnp) ((wnp)->bdr_style)
Returns the current window border style. (SGL_BDR,DBL_BDR,SLD_BDR,DUAL_BDR)
`co(10,1);/// wn_set_bdr_style`co();
#define wn_set_bdr_style(state,wnp) ((wnp)->bdr_style = state)
Sets the window border style. You must call wn_border to redraw.
`co(10,1);/// wn_get_cols`co();
#define wn_get_cols(wnp) ((wnp)->cols)
Returns the number of columns in the window, counting any border.
NOTE: There is no set macro as the columns cannot be changed directly.
`co(10,1);/// wn_get_csr_x`co();
#define wn_get_csr_x(wnp) ((wnp)->csr_x)
Returns the window's current cursor x position.
`co(10,1);/// wn_set_csr_x`co();
#define wn_set_csr_x(x,wnp) ((wnp)->csr_x = x)
Sets the window's current cursor x position.
`co(10,1);/// wn_get_csr_y`co();
#define wn_get_csr_y(wnp) ((wnp)->csr_y)
Returns the window's current cursor y position.
`co(10,1);/// wn_set_csr_y`co();
#define wn_set_csr_y(y,wnp) ((wnp)->csr_y = y)
Sets the window's current cursor y position.
`co(10,1);/// wn_get_name_loc`co();
#define wn_get_name_loc(wnp) ((wnp)->name_loc)
Returns the window's current name location. (CENTERED,LEFT_JUST,RIGHT_JUST)
`co(10,1);/// wn_set_name_loc`co();
#define wn_set_name_loc(state,wnp) ((wnp)->name_loc = state)
Sets the window's name location. Call wn_border to redraw.
`co(10,1);/// wn_get_rows`co();
#define wn_get_rows(wnp) ((wnp)->rows)
Returns the number of rows in the window, counting any border.
NOTE: There is no set macro as the rows cannot be changed directly.
`co(10,1);/// wn_is_bell_flag`co();
#define wn_is_bell_flag(wnp) ((wnp)->bell_flag)
Returns the state of the bell process flag. If wn_st_fmt() is used, and
this bit is set, a tone is sounded when a bell character is encountered.
`co(10,1);/// wn_set_bell_flag`co();
#define wn_set_bell_flag(state,wnp) ((wnp)->bell_flag = state)
Sets the state of the bell flag.
`co(10,1);/// wn_is_bk_flag`co();
#define wn_is_bk_flag(wnp) ((wnp)->bk_flag)
Returns the state of the backspace process flag. If wn_st_fmt() is used,
and this bit is set, a backspace will cause the cursor to move back one
space and delete the character.
`co(10,1);/// wn_set_bk_flag`co();
#define wn_set_bk_flag(state,wnp) ((wnp)->bk_flag = state)
Sets the state of backspace flag.
`co(10,1);/// wn_is_bs_clear`co();
#define wn_is_bs_clear(wnp) ((wnp)->bs_clear)
Returns the state of the backspace clear flag. This is used by the
function `keyword(wn_bksp,[uw_help2.hlp]/// wn_bksp); in uw_term.c and is used for terminal emulation support.
If set, a backspace will clear the previous character, otherwise, it will
simply move back one character, leaving the character unchanged.
`co(10,1);/// wn_set_bs_clear`co();
#define wn_set_bs_clear(state,wnp) ((wnp)->bs_clear = state)
Sets the state of the backspace clear flag.
`co(10,1);/// wn_is_cr_flag`co();
#define wn_is_cr_flag(wnp) ((wnp)->cr_flag)
Returns the state of the carriage return flag. If wn_st_fmt() is used,
and this bit is set, a carriage return will cause the cursor to move to
the first column of the current row. NOTE: The cursor is not moved
to the next row. (See wn_is_lf_flag).
`co(10,1);/// wn_set_cr_flag`co();
#define wn_set_cr_flag(state,wnp) ((wnp)->cr_flag = state)
Sets the state of the carriage return flag.
`co(10,1);/// wn_is_cr_lf_flag`co();
#define wn_is_cr_lf_flag(wnp) ((wnp)->cr_lf_flag)
Returns the state of the carriage return/line feed flag. If wn_st_fmt()
is used, and this bit is set, a carriage return OR line feed will cause
the cursor to move to the first column of the next line.
`co(10,1);/// wn_set_cr_lf_flag`co();
#define wn_set_cr_lf_flag(state,wnp) ((wnp)->cr_lf_flag = state)
Sets the state of t